﻿using System;
using System.Threading.Tasks;

namespace NetSync.Core
{
    public interface IWaitSync : IDisposable
    {
        Task<TData> WaitAsync<TData>(string key, Func<Task> action, int timeoutSecond = 120);

        /// <summary>
        /// 数据返回，同步处理
        /// </summary>
        /// <returns>true:说明数据已经处理; false: 数据未处理</returns>
        Task<bool> ReleaseAsync<TData>(string key, TData data);
    }
}